In order to evaluate the behaviour and performance of a computer system or a telecommunication system in real time and at different workloads, a so-called profiling tool may monitor the system performance and conduct a performance analysis in order to obtain the desired profile information. Such a profiling tool, i.e. a profiler, is capable of recording information at specific points of time or at specific events and of displaying the profile information, e.g. as a stream of recorded sample information or as a statistical summary.
The profiling information collected by a profiling tool is essential for the system characterization, and for enabling improvements in details and in the overall performance, as well as for identifying specific performance-related problems. However, some real time systems are not provided with any profiling capability at all, and some profiling tools may be unreliable or may need to be operated by a specialist in order to avoid disturbances, of the real-time system, and a corresponding reduced system performance. Other known profiling tools have a limited controllability and a low detail level of the collected information, in order to achieve reliability and a low performance-impact.
A suitable implementation of recording information for real-time profiling may comprise an interruption of the execution of a running program code at regular sampling intervals or at certain events, and conventional techniques for profiling include sampling techniques and instrumentation techniques, of which the sampling technique normally is more suitable for real-time profiling than instrumentation techniques.
Sampling techniques involve an interruption of the execution and a collection of data, and may be subdivided into periodic instruction profiling and event profiling, of which instruction profiling performs interruptions with specific time intervals to approximate a random behaviour, while event profiling interrupts the execution and collection of data at specific events. The instruction profiling is non-intrusive, and a reliable profile can be obtained comparatively quickly, and it may e.g. be used to obtain a profile of which part of a code that a processor executes the most by interrupting the execution periodically, with a certain sampling interval, and saving the instruction address.
The event profiling is also non-intrusive, but it takes longer to obtain a reliable profile. Event profiling may e.g. be used to obtain a profile of cache misses by interrupting the execution at every 1000 cache miss and recording the address and the time interval between these interruptions.
The capacity overhead caused by sampling profiling can be controlled by selecting an appropriate length of the sampling intervals, but it will also depend on the amount of collected information.
However, in event profiling techniques, only a few different and predefined parameters can be sampled, which may limit the profile. In sampling profiling, events may be missed if they do not occur in a sampling moment, which makes it unsuitable for obtaining a profile of the occurrence of rare events.
The instrumentation techniques may be subdivided into static and dynamic instrumentation, and static instrumentation involves instrumenting a binary code with added instructions for saving profiling information, e.g. each instruction that changes the control flow and causes a jump in the code to save the target address, in order to obtain a profile of which parts of the coded that is executed the most. By means of instrumentation profiling, a more detailed and complete information can be collected regarding individual instructions, a jump or a variable access. However, it consumes more capacity resulting in a large profiling capacity overhead, and a detailed instrumentation may slow down the system 10 times or more. Therefore, in order to achieve a lower overhead, the instrumentation must be limited to only a small fraction of the code, or be less detailed, which makes it unsuitable for real time systems. Further, two versions of the code will exist, the production method and the instrumented version, requiring switching between the two versions.
The conventional dynamic instrumentation is the latest and the most advanced profiling, method, and it may be programmable to enable an application specific profiling. A dynamic instrumentation tool inserts instrumentation points by replacing an instruction with a jump to a patch area, thereby achieving a dynamic modification of the instructions. The patch area comprises data associated with each instrumentation point, including instructions to be executed regarding the profiling, as well as instructions to return to the instrumentation point.
A dynamic instrumentation tool is capable of collecting both overall information and detailed information, and may be used interactively to first obtain a profile regarding an overall picture and thereafter to obtain a detailed profile regarding specific parts of said overall picture. Further, it is capable of safe collection of all occurrences of certain events, and is thereby suitable for obtaining a profile of rare events. However, a drawback of dynamic instrumentation is the large capacity overhead and that the size of this overhead can not be guaranteed, i.e. there is no guaranteed maximum capacity overhead. Additionally, the overhead is difficult to calculate, since it depends both on the profiling instruction and how often it is triggered, which may be unknown.
Related art within the technical field is further disclosed e.g. in the U.S. Pat. No. 5,689,636 and U.S. Pat. No. 5,794,011. U.S. Pat. No. 5,689,636 describes a real-time tracing system which causes a dynamic load, which is monitored by the tracing system itself. The tracing system also deactivates itself when this dynamic load exceeds a certain threshold value. A trace differs from a profile in that it represents a complete record of the steps executed of a program, while a profile is only a statistical display of a collection of selected events. U.S. Pat. No. 5,794,011 describes a performance regulating program for external units of a real-time system, and the program monitors and controls the performance level of the external units in order to avoid overload.
A conventional load regulating system in e.g. a telecommunication system supervises the system load and controls the traffic in order to avoid overload situations, which will lead to long delays and time-outs. A typical function of a telecommunication system load regulating function is to reject new calls before overload occurs when the load reaches, a predetermined limit, i.e. the maximum loadability. Thereby, the system will avoid overload, and use its capacity to handle real traffic instead of handling emergency tasks caused by overload. A computer control system is normally designed with different task priorities, and traffic handling is a high-priority task for both telecom and datacommunication systems. However, fault recovery comprising handling of faults in the hardware, in the software or in a network has an even higher priority, while it is desirable that maintenance tasks, e.g. profiling, such as hardware testing and software consistency audits are prioritized with a lower priority, since the collection of data should not be allowed to disturb the traffic. However, an additional drawback with the above-described conventional profiling methods is that the implementations may have a priority that is the same or even higher than the traffic. For example, instrumentation profiling inserts instructions that is executed as a part of the application and is therefore at the same priority level as the application. Similarly, sampling profiling using counters generates interrupts that are executed with a higher priority than the traffic.
Thus, it still presents a problem to provide profiling in a real-time system with a high reliability, causing a profiling overhead that will not overload the system.